package com.sky.controller.user;

import com.sky.dto.UserLoginDTO;
import com.sky.result.Result;
import com.sky.service.user.LoginService;
import com.sky.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(tags = "用户登录")
@RestController
@RequestMapping("/user/user")
public class LoginController {

    @Autowired
    private LoginService loginService;


    /**
     * 用户登录
     * @param userLoginDTO
     * @return
     */
    @ApiOperation("用户登录")
    @PostMapping("/login")
    public Result Login(@RequestBody UserLoginDTO userLoginDTO){
        UserLoginVO loginVo = loginService.login(userLoginDTO);
        log.info("小程序用户登录返回数据{}",loginVo);
        return Result.success(loginVo);
    }
}
